package com.leancloud.circle.activity;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.aries.ui.view.title.TitleBarView;
import com.avos.avoscloud.AVObject;
import com.leancloud.circle.R;
import com.leancloud.circle.adapter.CollectionAdapter;
import com.leancloud.circle.manage.CirclePathManage;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;

import java.util.ArrayList;
import java.util.List;

import tech.com.commoncore.base.BaseTitleActivity;
import tech.com.commoncore.view.SpaceItemDecoration;

@Route(path = CirclePathManage.CIRCLE_MY_LIKE)
public class MyLikeActivity extends BaseTitleActivity {

    private RecyclerView recyclerView;
    private SmartRefreshLayout smartRefreshLayout;
    private CollectionAdapter andCollectionAdapter;
    private TextView noDataTx;

    private List<AVObject> communityAVObjectList = new ArrayList<>();

    @Override
    public void setTitleBar(TitleBarView titleBar) {
        titleBar
                .setTitleMainText("我的点赞");
    }

    @Override
    public int getContentLayout() {
        return R.layout.activity_my_like;
    }

    @Override
    public void initView(Bundle savedInstanceState) {
        recyclerView = findViewById(R.id.my_like_recycler);
        smartRefreshLayout = findViewById(R.id.circle_recommend_smart_refresh);
        noDataTx = findViewById(R.id.no_data_value);

        andCollectionAdapter = new CollectionAdapter(R.layout.circle_layout_item_collection);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        int space = (int) getResources().getDimension(R.dimen.dp_10);
        recyclerView.addItemDecoration(new SpaceItemDecoration(space));
        recyclerView.setAdapter(andCollectionAdapter);

        smartRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh(RefreshLayout refreshLayout) {
                requestLikeData();
            }
        });

        if (communityAVObjectList.isEmpty()) {
            smartRefreshLayout.autoRefresh();
        }
    }

    private void requestLikeData() {


    }


}
